Convenience method. Assigns a function to a shortcut. The function gets the AGui instance as argument.